package bairui.international.weixin.portal.miniapp.controller.barter.score;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.lianjing.sh.spring.web.controller.base.action.Action;
import com.lianjing.sh.spring.web.controller.enhance.output.FomatOutput;

import bairui.international.model.domain.jpa.TB_UserAmount;
import bairui.international.service.Service_UserAmount;

/**
 *
 * 得到总积分
 *
 * @generated
 * 
 * @see STest_C_Barter_Score_GetAllScore_Get 测试
 *
 */
@Controller
public class C_Barter_Score_GetAllScore_Get
 extends SC_Barter_Score_GetAllScore_Get 
{
	
	@Autowired private Service_UserAmount service_UserAmount;
	
	/**
	 * Get请求
	 */
	@Action(Get.class)
	@GetMapping(Get.RequestMappingValue)
	public @FomatOutput @ResponseBody Object get(
		ModelMap map, HttpServletRequest request,
		@RequestParam String skey
	) throws Exception {
		if(service_UserAmount.exists(it->it.user.skey.eq(skey))){
			TB_UserAmount bean = service_UserAmount.findOne(it->it.user.skey.eq(skey));
			return bean.getGrade();
		}else{
			return 0;
		}
	}
	

}
